<%--
  Created by IntelliJ IDEA.
  User: Juan
  Date: 9/11/12
  Time: 23:32
  To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <meta name='layout' content='main'/>
    <title>Cargar fotos</title>
</head>

<body>
<br>

<div id="create-foto" class="content scaffold-create" role="main">
    <g:if test="${flash.message}">
        <div class="message" role="status">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${foto}">
        <ul class="errors" role="alert">
            <g:eachError bean="${foto}" var="error">
                <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message
                        error="${error}"/></li>
            </g:eachError>
        </ul>
    </g:hasErrors>
    <g:form controller="image" action="uploadFoto" enctype="multipart/form-data">
        <fieldset class="form">
            <div class="fieldcontain ${hasErrors(bean: foto, field: 'foto', 'error')} ">
                <label for="foto" style="text-align: left">
                    <g:message code="foto.foto.label" default="Foto"/>
                </label>
                <input type="file" id="foto" name="foto"/>
            </div>

            <div class="fieldcontain ${hasErrors(bean: foto, field: 'descripcion', 'error')} ">
                <label for="descripcion" style="text-align: left">
                    <g:message code="foto.descripcion.label" default="Descripcion"/>

                </label>
                <g:textArea name="descripcion" cols="40" rows="5" maxlength="255" value="${foto?.descripcion}"/>
            </div>

            <div class="fieldcontain ${hasErrors(bean: foto, field: 'fotoPrincipal', 'error')} ">
            <label for="fotoPrincipal" style="text-align: left">Foto Principal?</label>
            <g:checkBox name="fotoPrincipal" value="Foto Principal"/>
            </div>
        </fieldset>
        <fieldset style="text-align: center">
            <g:submitButton name="create" class="button"
                            value="Enviar"/>
            <g:submitButton name="otraFoto" class="button"
                            value="Enviar y subir otra"/>
        </fieldset>
    </g:form>
</div>
<br>
</body>
</html>